home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / dir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-30  |  2.5 KB  |  91 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /*  Dir.c  */
  22.  
  23. #include <externs.h>
  24.  
  25.  
  26.  
  27. void AVL_SET_DIRECTORIES()
  28. {
  29.     char f[2][AVL_MAX_LINEL+10];
  30.     AVL_EDIT_WINDOW_PTR w;
  31.     AVL_WIN_PTR m;
  32.     int n1, n2, ch, i;
  33.     static char *msg = " GWAda - Directories ";
  34.     static char *msgs[4] = {"Ada sources: "
  35.                            ,"Library    : "
  36.                            ,"Ok" 
  37.                            ,"Cancel"};
  38.     int current = 1;
  39.     w = &avl_windows[avl_window];
  40.     n1 = 66;
  41.     n2 = (80 - n1) / 2;
  42.     strcpy(f[0],avl_dir_sources);
  43.     strcpy(f[1],avl_dir_library);
  44.     m = AVL_MAKE_WINDOW(msg,7,n2,12,n1+n2,avl_wnd_bk_color,avl_wnd_color);
  45.     while ( 1 )  {
  46.         for(i = 1; i < 5; ++i)  {
  47.             _settextposition(i,1);
  48.             _settextcolor(avl_men_letter);
  49.             _outmem(msgs[i-1],1);
  50.             _settextcolor(avl_men_word);
  51.             _outtext(msgs[i-1] + 1);
  52.             if (i < 3)
  53.                 _outtext(f[i-1]);
  54.             }
  55.         ch = getch();
  56.         switch( toupper(ch) )  {
  57.             case 'A' :
  58.                 current = 1;
  59.                 AVL_PROMPT(current,strlen(msgs[current-1]) + 1,f[current-1],40);
  60.                 break;
  61.             case 'L' :
  62.                 current = 2;
  63.                 AVL_PROMPT(current,strlen(msgs[current-1]) + 1,f[current-1],40);
  64.                 break;
  65.             case 'O' :
  66.                     strcpy(avl_dir_sources,f[0]);
  67.                     strcpy(avl_dir_library,f[1]);
  68.                     AVL_DEL_WINDOW(m);
  69.                     return;
  70.             case 27  :
  71.             case 'C' :
  72.                     AVL_DEL_WINDOW(m);
  73.                     return;
  74.             case 0   : 
  75.             case 0XE0: {
  76.                 ch = getch();
  77.                 switch(ch)  {
  78.                     case 72 : /* Up  */ 
  79.                         if (--current < 1) current = 2;
  80.                         break;
  81.                     case 80 : /* Down */ 
  82.                         if (++current > 2) current = 1;
  83.                         break;
  84.                     default : putch(7); break;
  85.                     }
  86.                 break;
  87.                 }
  88.             default : putch(7); break;
  89.             }
  90.         }
  91. }
  92.